<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>出入库信息管理</title>
<meta name="decorator" content="default" />
<style type="text/css">		
	#contentTable td ,#contentTable th{
		text-align: center;
	}
	.minWidth {
		min-width: 177px;
	}
	.autoWidth {
	    width: auto;
	}	
	.select2-choices{
	    border-radius: 4px;
	}
</style>
<script type="text/javascript">
	$(document).ready(function() {
		$("#btnDown").click(function() {
			layer.confirm('确认要导出出入库订单数据吗？', {
				btn : [ '确认', '取消' ]
			}, function() {
				$("#searchForm").attr("action", "${ctx}/company/bsVaccineCompany/exportExcel");
				$("#searchForm").submit();
				layer.msg('正在导出', {icon: 1});
				$("#searchForm").attr("action", "${ctx}/company/bsVaccineCompany/allList");
			}, function() {
				
			});
		});
	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}

	function rese() {//重置
		$("#orderStatus").val("").select2();
		$("#vaccineId").val("");
		$("#startDate").val("");
		$("#endDate").val("");
		$("#batchno").val("");
		$("#orderNo").val("");
	}

	function deleteOrder(id) {
		layer.confirm('确认要删除此条订单数据吗？', {
			icon: 2, title:'提示', btn : [ '确认', '取消' ]
		}, function() {
			$("#searchForm").attr("action", "${ctx}/order/bsVaccineOrder/delete?id="+id);
			$("#searchForm").submit();
			$("#searchForm").attr("action", "");
			layer.msg('正在删除', {icon: 1});
		}, function() {
			
		});
	};
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a>出入库信息列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="bsVaccineOrder" action="${ctx}/company/bsVaccineCompany/allList" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
		<table class="table table-bordered">
			<tr>
				<th>疫苗类型：</th>
				<td><form:select path="cType" id="cType"  class="span2 minWidth">
					<form:option value="" label="--请选择--" />
					<form:options items="${fns:getDictList('bs_vaccine_type')}" itemLabel="label" itemValue="value" htmlEscape="false" />
				</form:select></td>
				<th>疫苗批号：</th>
				<td><input type="text" name="batchno" id="batchno" class="input-medium" value="${bsVaccineOrder.batchno}"/></td>
				<th>出入库单号：</th>
				<td><input type="text" name="orderNo" id="orderNo" class="input-medium" value="${bsVaccineOrder.orderNo}"/></td>
			</tr>
			<tr>
				<th>出入库开始日期:</th>
				<td><input name="startDate" id="startDate" type="text"
					readonly="readonly" maxlength="20" class="input-medium Wdate"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"
					value='<fmt:formatDate value='${bsVaccineOrder.startDate}' pattern="yyyy-MM-dd" />' />
				</td>
				<th>出入库截至日期:</th>
				<td colspan="3"><input name="endDate" id="endDate" type="text"
					readonly="readonly" maxlength="20" class="input-medium Wdate" 
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"
					value='<fmt:formatDate value='${bsVaccineOrder.endDate}' pattern="yyyy-MM-dd" />' />
				</td>
			</tr>
		</table>
		<div>
			<button id="btnSubmit" class="btn btn-primary" type="submit" >查询</button>
			<button id="btnReset" class="btn btn-primary" type="button" onclick = "rese()">重置</button>
			<button id="btnDown" class="btn btn-primary" type="button" >导出</button>
		</div>
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>编号</th>
				<th>操作</th>
				<th>类型</th>
				<th>疫苗类型</th>
				<th>订单号</th>
				<th>订单状态</th>
				<th>是否付款</th>
				<th>出入库日期</th>
				<th>供货单位</th>
				<th>收货单位</th>
				<th>录入单位</th>
				<th>创建日期</th>
			</tr>
		</thead>
		<tbody id="check">
			<c:forEach items="${page.list}" var="bvo" begin="0" varStatus="status">
				<tr>
					<td>${(page.pageNo-1)*page.pageSize+status.index+1 }</td>
					<td><a href="${ctx}/company/bsVaccineCompany/veiwForm?id=${bvo.id}">查看</a>
					<shiro:hasPermission name="order:bsVaccineOrder:edit">
					<c:if test="${bvo.createcode==BsVaccineOrder.createcode}">
						<c:if test="${bvo.orderStatus==6||bvo.orderStatus==7||bvo.orderStatus==9||bvo.orderStatus==12}">
							<a href="javascript:void(0)" onclick="deleteOrder('${bvo.id}');">删除</a>
						</c:if>
					</c:if>
					</shiro:hasPermission>
					</td>
					<td>${fns:getDictLabel(bvo.orderType, "bs_order_ordertype", "")}
					</td>
					<td>${fns:getDictLabel(bvo.cType, "bs_vaccine_type", "")}</td>
					<td>${bvo.orderNo}</td>
					<td>${fns:getDictLabel(bvo.orderStatus, "bs_order_status", "")} </td>
					<td> <c:choose>  
						<c:when test="${bvo.cType == 2 && bvo.orderType == 1 && (bvo.orderStatus==3||bvo.orderStatus==5)}"> 
						${fns:getDictLabel(bvo.isPay, "is_pay", "")}
						</c:when>  
						<c:otherwise> - </c:otherwise>  
					</c:choose> </td>
					<td><fmt:formatDate value="${bvo.outboundDate}" pattern="yyyy-MM-dd" /></td>
					<td>${bvo.supplyorgName}</td>
					<td>${bvo.receiveorgName}</td>
					<td>${bvo.createorgName}</td>
					<td><fmt:formatDate value="${bvo.createDate}" pattern="yyyy-MM-dd" /></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>